
use KunzeMiller_regressiondataset


*****************************************************************************
display "Variable Creation"
*Variable Creation
*****************************************************************************
 
. qui xi i.yr i.age i.eduy  

. qui tab ind1, gen(IND)

. drop IND1

. qui tab level, gen(RANK)

. gen exp2=exp*exp
(51710 missing values generated)

. gen topwage=(lnw>lnw70_RPY) /* we use this in table 1 */

. gen kids_fem=kids*fem
(51710 missing values generated)

. gen kids6_fem=kids6*fem
(51710 missing values generated)

. gen rank=level
(16 missing values generated)

. gen double hc=plant*100000+yr*10+rank
(16 missing values generated)

. 
. * create main gender spillover variables
. gen femfrfembo=fem*fraclev_womboss1_RPY
(211436 missing values generated)

. gen femfrfem=fem*fraclev_wom_RPY
(51710 missing values generated)

. gen fracwom_inter= fraclev_wom_RPY * fraclev_womboss1_RPY 
(211436 missing values generated)

. gen femfracwom_inter= fem*fraclev_wom_RPY * fraclev_womboss1_RPY 
(211436 missing values generated)

. 
. label define fem 0 "Male" 1 "Female", replace

. label values fem fem

. label variable RANK1 "Rank = 1"

. label variable RANK2 "Rank = 2"

. label variable RANK3 "Rank = 3"

. label variable RANK4 "Rank = 4"

. label variable RANK5 "Rank = 5"

. label variable RANK6 "Rank = 6"

. label variable RANK7 "Rank = 7"

. label variable fem "Female"

. label variable exp "Years Work Experience"

. label variable exp2 "Years Experience Squared"

. label variable tenure "Years Tenure"

. label variable tenure2 "Years Tenure Squared"

. label variable part "Working Part-Time"

. label variable tenrank "Rank Specific Tenure"

. label variable eduy "Years Schooling"

. label variable kids "Any Children"

. label variable kids6 "Children under 6"

. label variable kids_fem "Female * Children"

. label variable kids6_fem "Female * Children 6 or Under"

. label variable hc "Plant-Year-Rank Index"

. label variable promotion "Promotion"

. label variable intpromotion "Internal Promotion"

. label variable stayplant "Stay at Plant"

. label variable fraclev_wom_RPY "Female Peer Share"

. label variable fraclev_womboss1_RPY "Female Boss Share "

. label variable fraclev_womboss2_RPY "Female Boss (+2) Share "

. label variable femfrfembo "Female * Female Boss Share"

. label variable femfrfem "Female * Female Peer Share"

. label variable fracwom_inter "Female Peer Share * Female Boss Share "

. label variable femfracwom_inter "Female * Female Peer * Female Boss"

. 
. * occupation groups
. decode occupgr, gen(occ2)

. gen occgroup = substr(occ2, 1, 1)
(51726 missing values generated)

. qui tab occgroup, gen(doccup)

. drop doccup6

. *****************************************************************************
> *********
. 
. display "Output for Tables 1 and 2"
Output for Tables 1 and 2

. 
. *****************************************************************************
> *********
. 
. *****************************************************************************
> *********
. * Define key vectors of variables
. global xlist1 fem 

. global controllistextralong RANK* _Iyr_* _Iage_* _Ieduy_* doccup* exp exp2 te
> nure tenure2 tenrank part

. global xspill1 femfrfembo femfrfem fraclev_womboss1_RPY fraclev_wom_RPY 

. 
. *****************************************************************************
> *********
. 
. * List of Tables
. * Table 1: Summary Stats by Sex (mean values of all covariates and outcomes) 
. * Table 2: Gender spillovers - main measure of bosses/peers - 3 outcomes (pan
> els); 3 models with diff controls (columns)
.  
. * define main estimation samples
. qui reg promotion $xlist1 $controllistextralong IND* 

. gen mainsample = e(sample) /* this sample includes all ranks and is used for 
> top panel of Table 1 only */

. qui reg promotion $xspill1 $controllistextralong IND* if level <=6

. gen mainspillsample = e(sample) /* this sample is for the rest of Table 1 and
>  for Table 2*/

. 
. *****************************************************************************
> *********
. 
. display "Table 1: Summary Statistics"
Table 1: Summary Statistics

. 
. *****************************************************************************
> *********
. 
. keep if mainsample ==1
(131219 observations deleted)

. estpost tabstat RANK*, by(fem) columns(statistics)

Summary statistics: mean
     for variables: RANK1 RANK2 RANK3 RANK4 RANK5 RANK6 RANK7
  by categories of: fem

         fem |   e(mean) 
-------------+-----------
Male         |           
       RANK1 |  .0238808 
       RANK2 |   .180806 
       RANK3 |   .279316 
       RANK4 |  .2896861 
       RANK5 |  .0785865 
       RANK6 |   .132316 
       RANK7 |  .0154087 
-------------+-----------
Female       |           
       RANK1 |  .2713931 
       RANK2 |  .1472546 
       RANK3 |  .3984347 
       RANK4 |  .1447008 
       RANK5 |  .0119144 
       RANK6 |  .0252214 
       RANK7 |   .001081 
-------------+-----------
Total        |           
       RANK1 |  .0943063 
       RANK2 |  .1712595 
       RANK3 |  .3132093 
       RANK4 |  .2484329 
       RANK5 |  .0596161 
       RANK6 |   .101844 
       RANK7 |   .011332 

. 
. keep if mainspillsample ==1
(146979 observations deleted)

. estpost tabstat fem promotion intpromotion stayplant age eduy exp tenure tenr
> ank part kids kids6 fraclev_womboss1_RPY fraclev_wom_RPY, by(fem) columns(sta
> tistics)

Summary statistics: mean
     for variables: fem promotion intpromotion stayplant age eduy exp tenure te
> nrank part kids kids6 fraclev_womboss1_RPY fraclev_wom_RPY
  by categories of: fem

         fem |   e(mean) 
-------------+-----------
Male         |           
         fem |         0 
   promotion |  .0730286 
intpromotion |   .058901 
   stayplant |  .7396525 
         age |   40.1765 
        eduy |  12.59947 
         exp |  18.41976 
      tenure |  7.406774 
     tenrank |  4.293088 
        part |  .0755122 
        kids |  .6990673 
       kids6 |  .3252557 
fracle~1_RPY |  .1426803 
fracle~m_RPY |  .1763085 
-------------+-----------
Female       |           
         fem |         1 
   promotion |  .0656564 
intpromotion |  .0559732 
   stayplant |  .7353278 
         age |  37.11903 
        eduy |    11.711 
         exp |   14.5363 
      tenure |  6.520195 
     tenrank |  4.036998 
        part |  .2625802 
        kids |  .5642334 
       kids6 |  .2697236 
fracle~1_RPY |  .2456838 
fracle~m_RPY |  .5849057 
-------------+-----------
Total        |           
         fem |  .2951844 
   promotion |  .0708524 
intpromotion |  .0580368 
   stayplant |  .7383759 
         age |  39.27399 
        eduy |  12.33721 
         exp |  17.27343 
      tenure |   7.14507 
     tenrank |  4.217494 
        part |  .1307317 
        kids |  .6592665 
       kids6 |  .3088635 
fracle~1_RPY |  .1730853 
fracle~m_RPY |    .29692 

. 
. drop RANK7

. drop RANK6 /*reference group*/

. 
. *****************************************************************************
> *******
. 
. display "Table 2: Gender Spillovers in Promotions and Mobility" 
Table 2: Gender Spillovers in Promotions and Mobility

. 
. *****************************************************************************
> *******
. 
. foreach outvar in promotion intpromotion stayplant {
  2. * basic controls
. qui reg `outvar' $xspill1 $xlist1 $controllistextralong IND* , cluster(hc)
  3. esttab,stats(N r2) label starlevels(* 0.10 ** 0.05 *** 0.01) cells(b(star 
> fmt(a2)) se(fmt(a2) par ([ ])))  keep(femfrfembo femfrfem fraclev_womboss1_RP
> Y fraclev_wom_RPY)
  4. 
. * plant FE
. qui areg `outvar' $xspill1 $xlist1 $controllistextralong, cluster(hc) absorb(
> plant)
  5. esttab,stats(N r2) label starlevels(* 0.10 ** 0.05 *** 0.01) cells(b(star 
> fmt(a2)) se(fmt(a2) par ([ ])))  keep(femfrfembo femfrfem fraclev_womboss1_RP
> Y fraclev_wom_RPY)
  6. 
. * children FE
. qui areg `outvar' $xspill1 $xlist1 $controllistextralong kids kids6 kids_fem 
> kids6_fem, cluster(hc) absorb(plant)
  7. esttab,stats(N r2) label starlevels(* 0.10 ** 0.05 *** 0.01) cells(b(star 
> fmt(a2)) se(fmt(a2) par ([ ])))  keep(femfrfembo femfrfem fraclev_womboss1_RP
> Y fraclev_wom_RPY)
  8. 
. * Individual FE using Abowd-Kramarz estimation
. display "Dependent variable: `outvar�"
  9. qui felsdvreg `outvar' $xspill1 $xlist1 $controllistextralong, ivar(pid) jvar
> (plant) feff(feff) peff(peff) mover(mover) group(group) xb(xb) res(res) mnum(
> mnum) pobs(pobs) cluster(hc)
 10. esttab, stats(N r2) label starlevels(* 0.10 ** 0.05 *** 0.01) cells(b(star
>  fmt(a2)) se(fmt(a2) par ([ ])))  keep(femfrfembo femfrfem fraclev_womboss1_R
> PY fraclev_wom_RPY)
 11. }

------------------------------------
                              (1)   
                        Promotion   
                             b/se   
------------------------------------
Female * Female Bo~e        0.020***
                         [0.0044]   
Female * Female Pe~e       -0.060***
                         [0.0054]   
Female Boss Share          0.0048   
                         [0.0037]   
Female Peer Share           0.050***
                         [0.0048]   
------------------------------------
N                          597552   
r2                          0.050   
------------------------------------

------------------------------------
                              (1)   
                        Promotion   
                             b/se   
------------------------------------
Female * Female Bo~e        0.019***
                         [0.0047]   
Female * Female Pe~e       -0.060***
                         [0.0057]   
Female Boss Share         -0.0058   
                         [0.0049]   
Female Peer Share           0.036***
                         [0.0059]   
------------------------------------
N                          597552   
r2                          0.073   
------------------------------------

------------------------------------
                              (1)   
                        Promotion   
                             b/se   
------------------------------------
Female * Female Bo~e        0.018***
                         [0.0047]   
Female * Female Pe~e       -0.062***
                         [0.0057]   
Female Boss Share         -0.0054   
                         [0.0049]   
Female Peer Share           0.037***
                         [0.0059]   
------------------------------------
N                          597552   
r2                          0.073   
------------------------------------
Dependent variable: Promotion

------------------------------------
                              (1)   
                                    
                             b/se   
------------------------------------
Female * Female Bo~e        0.021** 
                         [0.0095]   
Female * Female Pe~e       -0.040***
                          [0.011]   
Female Boss Share         -0.0036   
                         [0.0073]   
Female Peer Share           0.031***
                         [0.0093]   
------------------------------------
N                          597552   
r2                                  
------------------------------------

------------------------------------
                              (1)   
                     Internal P~n   
                             b/se   
------------------------------------
Female * Female Bo~e        0.022***
                         [0.0040]   
Female * Female Pe~e       -0.055***
                         [0.0051]   
Female Boss Share          0.0019   
                         [0.0033]   
Female Peer Share           0.045***
                         [0.0045]   
------------------------------------
N                          597552   
r2                          0.041   
------------------------------------

------------------------------------
                              (1)   
                     Internal P~n   
                             b/se   
------------------------------------
Female * Female Bo~e        0.019***
                         [0.0043]   
Female * Female Pe~e       -0.052***
                         [0.0053]   
Female Boss Share         -0.0068   
                         [0.0044]   
Female Peer Share           0.031***
                         [0.0056]   
------------------------------------
N                          597552   
r2                          0.061   
------------------------------------

------------------------------------
                              (1)   
                     Internal P~n   
                             b/se   
------------------------------------
Female * Female Bo~e        0.019***
                         [0.0043]   
Female * Female Pe~e       -0.053***
                         [0.0053]   
Female Boss Share         -0.0065   
                         [0.0044]   
Female Peer Share           0.031***
                         [0.0056]   
------------------------------------
N                          597552   
r2                          0.061   
------------------------------------
Dependent variable: Internal Promotion

------------------------------------
                              (1)   
                                    
                             b/se   
------------------------------------
Female * Female Bo~e        0.032***
                         [0.0088]   
Female * Female Pe~e       -0.033***
                          [0.011]   
Female Boss Share         -0.0078   
                         [0.0065]   
Female Peer Share           0.031***
                         [0.0090]   
------------------------------------
N                          597552   
r2                                  
------------------------------------

------------------------------------
                              (1)   
                     Stay at Pl~t   
                             b/se   
------------------------------------
Female * Female Bo~e        0.015*  
                         [0.0080]   
Female * Female Pe~e       -0.045***
                          [0.010]   
Female Boss Share          -0.016** 
                         [0.0082]   
Female Peer Share           0.031***
                         [0.0093]   
------------------------------------
N                          597552   
r2                           0.32   
------------------------------------

------------------------------------
                              (1)   
                     Stay at Pl~t   
                             b/se   
------------------------------------
Female * Female Bo~e       0.0044   
                         [0.0068]   
Female * Female Pe~e        0.012   
                         [0.0086]   
Female Boss Share          0.0016   
                         [0.0080]   
Female Peer Share         -0.0032   
                         [0.0098]   
------------------------------------
N                          597552   
r2                           0.44   
------------------------------------

------------------------------------
                              (1)   
                     Stay at Pl~t   
                             b/se   
------------------------------------
Female * Female Bo~e       0.0046   
                         [0.0068]   
Female * Female Pe~e        0.013   
                         [0.0086]   
Female Boss Share          0.0017   
                         [0.0080]   
Female Peer Share         -0.0038   
                         [0.0098]   
------------------------------------
N                          597552   
r2                           0.44   
------------------------------------

Dependent variable: Stay at Plant


------------------------------------
                              (1)   
                                    
                             b/se   
------------------------------------
Female * Female Bo~e       0.0028   
                          [0.012]   
Female * Female Pe~e      -0.0061   
                          [0.013]   
Female Boss Share          0.0072   
                          [0.012]   
Female Peer Share          0.0095   
                          [0.013]   
------------------------------------
N                          597552   
r2                                  
------------------------------------


. log close
  
-------------------------------------------------------------------------------

